This journal shows how to load the baselines and run the dynamic mas flow analysis, plotting the results for two scenarios and two materials.
import os
from pathlib import Path
testfolder = str(Path().resolve().parent.parent / 'PV_ICE' / 'TEMP')
# Another option using relative address; for some operative systems you might need '/' instead of '\'
# testfolder = os.path.abspath(r'..\..\PV_DEMICE\TEMP')
print ("Your simulation will be stored in %s" % testfolder)
Your simulation will be stored in C:\Users\sayala\Documents\GitHub\PV_ICE\PV_ICE\TEMP
import PV_ICE
silicon and glass materials are added to the two simulations, along with a scenario, in this case the baseline_modules_US. The baseline files for decadence scenario will be modified.
r1 = PV_ICE.Simulation(name='Simulation1', path=testfolder)
r1.createScenario(name='standard', file=r'..\baselines\baseline_modules_US.csv')
r1.scenario['standard'].addMaterial('glass', file=r'..\baselines\baseline_material_glass.csv')
r1.scenario['standard'].addMaterial('silicon', file=r'..\baselines\baseline_material_silicon.csv' )
r1.createScenario('decadence', file=r'..\baselines\baseline_modules_US.csv')
r1.scenario['decadence'].addMaterial('glass', file=r'..\baselines\baseline_material_glass.csv')
r1.scenario['decadence'].addMaterial('silicon', file=r'..\baselines\baseline_material_silicon.csv')
path = C:\Users\sayala\Documents\GitHub\PV_ICE\PV_ICE\TEMP
We have some functions to create changes based on improvements, but for this example we'll just be modifying values for the full column and comparing effects.
r1.scenario['decadence'].data['mod_lifetime'] = 35
r1.scenario['decadence'].material['glass'].materialdata['mat_virgin_eff'] = 70.0
r1.scenario['decadence'].material['silicon'].materialdata['mat_virgin_eff'] = 80.0
r1.scenario['decadence'].material['silicon'].materialdata['mat_EOL_collected_Recycled'] = 100.0
r1.scenario['decadence'].material['silicon'].materialdata['mat_massperm2'] = 22
r1.calculateMassFlow()
r1.aggregateResults();
Working on Scenario: standard ******************** Finished Area+Power Generation Calculations ==> Working on Material : glass ==> Working on Material : silicon Working on Scenario: decadence ******************** Finished Area+Power Generation Calculations ==> Working on Material : glass ==> Working on Material : silicon
Pull out the keywords by printing the keys to the module data or the material data:
print(r1.scenario.keys())
print(r1.scenario['standard'].data.keys())
print(r1.scenario['standard'].material['glass'].materialdata.keys())
#print(r1.scenario.keys())
#print(r1.scenario['standard'].data.keys())
print(r1.scenario['standard'].material['glass'].materialdata.keys())
Index(['year', 'mat_virgin_eff', 'mat_massperm2', 'mat_MFG_eff',
'mat_MFG_scrap_Recycled', 'mat_MFG_scrap_Recycling_eff',
'mat_MFG_scrap_Recycled_into_HQ',
'mat_MFG_scrap_Recycled_into_HQ_Reused4MFG',
'mat_EOL_collected_Recycled', 'mat_EOL_Recycling_eff',
'mat_EOL_Recycled_into_HQ', 'mat_EOL_RecycledHQ_Reused4MFG',
'mat_modules_Collected', 'mat_modules_NotCollected',
'mat_modules_Recycled', 'mat_modules_NotRecycled',
'mat_EOL_sento_Recycling', 'mat_EOL_NotRecycled_Landfilled',
'mat_EOL_Recycled', 'mat_EOL_Recycled_Losses_Landfilled',
'mat_EOL_Recycled_2_HQ', 'mat_EOL_Recycled_2_OQ',
'mat_EoL_Recycled_HQ_into_MFG', 'mat_EOL_Recycled_HQ_into_OU',
'mat_UsedSuccessfullyinModuleManufacturing',
'mat_EnteringModuleManufacturing', 'mat_LostinModuleManufacturing',
'mat_Manufacturing_Input', 'mat_MFG_Scrap',
'mat_MFG_Scrap_Sentto_Recycling', 'mat_MFG_Scrap_Landfilled',
'mat_MFG_Scrap_Recycled_Successfully',
'mat_MFG_Scrap_Recycled_Losses_Landfilled', 'mat_MFG_Recycled_into_HQ',
'mat_MFG_Recycled_into_OQ', 'mat_MFG_Recycled_HQ_into_MFG',
'mat_MFG_Recycled_HQ_into_OU', 'mat_Virgin_Stock',
'mat_Virgin_Stock_Raw', 'mat_Total_EOL_Landfilled',
'mat_Total_MFG_Landfilled', 'mat_Total_Landfilled',
'mat_Total_Recycled_OU'],
dtype='object')
r1.plotScenariosComparison(keyword='Cumulative_Area_disposedby_Failure')
r1.plotMaterialComparisonAcrossScenarios(material='silicon', keyword='mat_Total_Landfilled')
r1.plotMaterialResults(keyword='VirginStock')
r1.plotMetricResults()
['standard', 'decadence']
r1.plotInstalledCapacityResults()
['standard', 'decadence']
datay = r1.USyearly
datac = r1.UScum
filter_colc = [col for col in datac if col.startswith('newInstalledCapacity')]
filter_coly = [col for col in datay if col.startswith('Capacity')]
datac[filter_colc]
| newInstalledCapacity_standard_[MW] | newInstalledCapacity_decadence_[MW] | |
|---|---|---|
| year | ||
| 1995 | 1.250000e+01 | 1.250000e+01 |
| 1996 | 2.216767e+01 | 2.216767e+01 |
| 1997 | 3.378967e+01 | 3.378967e+01 |
| 1998 | 4.557067e+01 | 4.557067e+01 |
| 1999 | 6.245533e+01 | 6.245533e+01 |
| 2000 | 8.338200e+01 | 8.338200e+01 |
| 2001 | 1.113670e+02 | 1.113670e+02 |
| 2002 | 1.538430e+02 | 1.538430e+02 |
| 2003 | 2.135880e+02 | 2.135880e+02 |
| 2004 | 3.083400e+02 | 3.083400e+02 |
| 2005 | 4.049212e+02 | 4.049212e+02 |
| 2006 | 5.031342e+02 | 5.031342e+02 |
| 2007 | 8.273670e+02 | 8.273670e+02 |
| 2008 | 1.141952e+03 | 1.141952e+03 |
| 2009 | 1.573197e+03 | 1.573197e+03 |
| 2010 | 2.293041e+03 | 2.293041e+03 |
| 2011 | 4.074418e+03 | 4.074418e+03 |
| 2012 | 7.138581e+03 | 7.138581e+03 |
| 2013 | 1.117603e+04 | 1.117603e+04 |
| 2014 | 1.489823e+04 | 1.489823e+04 |
| 2015 | 2.173256e+04 | 2.173256e+04 |
| 2016 | 3.463022e+04 | 3.463022e+04 |
| 2017 | 4.441473e+04 | 4.441473e+04 |
| 2018 | 5.376726e+04 | 5.376726e+04 |
| 2019 | 6.471704e+04 | 6.471704e+04 |
| 2020 | 7.962083e+04 | 7.962083e+04 |
| 2021 | 9.607639e+04 | 9.607639e+04 |
| 2022 | 1.113036e+05 | 1.113036e+05 |
| 2023 | 1.265276e+05 | 1.265276e+05 |
| 2024 | 1.431621e+05 | 1.431621e+05 |
| 2025 | 1.612770e+05 | 1.612770e+05 |
| 2026 | 1.810041e+05 | 1.810041e+05 |
| 2027 | 2.024869e+05 | 2.024869e+05 |
| 2028 | 2.258817e+05 | 2.258817e+05 |
| 2029 | 2.513587e+05 | 2.513587e+05 |
| 2030 | 2.791031e+05 | 2.791031e+05 |
| 2031 | 3.093167e+05 | 3.093167e+05 |
| 2032 | 3.422194e+05 | 3.422194e+05 |
| 2033 | 3.780504e+05 | 3.780504e+05 |
| 2034 | 4.170703e+05 | 4.170703e+05 |
| 2035 | 4.595630e+05 | 4.595630e+05 |
| 2036 | 5.058376e+05 | 5.058376e+05 |
| 2037 | 5.562306e+05 | 5.562306e+05 |
| 2038 | 6.111086e+05 | 6.111086e+05 |
| 2039 | 6.708708e+05 | 6.708708e+05 |
| 2040 | 7.359517e+05 | 7.359517e+05 |
| 2041 | 8.068249e+05 | 8.068249e+05 |
| 2042 | 8.840058e+05 | 8.840058e+05 |
| 2043 | 9.680558e+05 | 9.680558e+05 |
| 2044 | 1.059586e+06 | 1.059586e+06 |
| 2045 | 1.159263e+06 | 1.159263e+06 |
| 2046 | 1.267811e+06 | 1.267811e+06 |
| 2047 | 1.386019e+06 | 1.386019e+06 |
| 2048 | 1.514749e+06 | 1.514749e+06 |
| 2049 | 1.654935e+06 | 1.654935e+06 |
| 2050 | 1.807597e+06 | 1.807597e+06 |
data = datac[filter_colc].copy()
data.join(datay[filter_coly].copy())
| newInstalledCapacity_standard_[MW] | newInstalledCapacity_decadence_[MW] | Capacity_standard_[MW] | Capacity_decadence_[MW] | |
|---|---|---|---|---|
| year | ||||
| 1995 | 1.250000e+01 | 1.250000e+01 | 1.250000e+01 | 1.250000e+01 |
| 1996 | 2.216767e+01 | 2.216767e+01 | 2.209888e+01 | 2.209888e+01 |
| 1997 | 3.378967e+01 | 3.378967e+01 | 3.359842e+01 | 3.359842e+01 |
| 1998 | 4.557067e+01 | 4.557067e+01 | 4.518868e+01 | 4.518868e+01 |
| 1999 | 6.245533e+01 | 6.245533e+01 | 6.180214e+01 | 6.180214e+01 |
| 2000 | 8.338200e+01 | 8.338200e+01 | 8.232501e+01 | 8.232501e+01 |
| 2001 | 1.113670e+02 | 1.113670e+02 | 1.096988e+02 | 1.096988e+02 |
| 2002 | 1.538430e+02 | 1.538430e+02 | 1.512488e+02 | 1.512488e+02 |
| 2003 | 2.135880e+02 | 2.135880e+02 | 2.095747e+02 | 2.095747e+02 |
| 2004 | 3.083400e+02 | 3.083400e+02 | 3.021966e+02 | 3.021966e+02 |
| 2005 | 4.049212e+02 | 4.049212e+02 | 3.859873e+02 | 3.956005e+02 |
| 2006 | 5.031342e+02 | 5.031342e+02 | 4.736559e+02 | 4.894643e+02 |
| 2007 | 8.273670e+02 | 8.273670e+02 | 7.947645e+02 | 8.080952e+02 |
| 2008 | 1.141952e+03 | 1.141952e+03 | 1.103995e+03 | 1.114463e+03 |
| 2009 | 1.573197e+03 | 1.573197e+03 | 1.527483e+03 | 1.534977e+03 |
| 2010 | 2.293041e+03 | 2.293041e+03 | 2.236089e+03 | 2.240861e+03 |
| 2011 | 4.074418e+03 | 4.074418e+03 | 4.002599e+03 | 4.005224e+03 |
| 2012 | 7.138581e+03 | 7.138581e+03 | 7.037122e+03 | 7.045450e+03 |
| 2013 | 1.117603e+04 | 1.117603e+04 | 1.103376e+04 | 1.104702e+04 |
| 2014 | 1.489823e+04 | 1.489823e+04 | 1.469685e+04 | 1.471694e+04 |
| 2015 | 2.173256e+04 | 2.173256e+04 | 2.146720e+04 | 2.148175e+04 |
| 2016 | 3.463022e+04 | 3.463022e+04 | 3.427216e+04 | 3.428151e+04 |
| 2017 | 4.441473e+04 | 4.441473e+04 | 4.391453e+04 | 4.391967e+04 |
| 2018 | 5.376726e+04 | 5.376726e+04 | 5.308262e+04 | 5.308494e+04 |
| 2019 | 6.471704e+04 | 6.471704e+04 | 6.380539e+04 | 6.380619e+04 |
| 2020 | 7.962083e+04 | 7.962083e+04 | 7.843322e+04 | 7.843424e+04 |
| 2021 | 9.607639e+04 | 9.607639e+04 | 9.452318e+04 | 9.452452e+04 |
| 2022 | 1.113036e+05 | 1.113036e+05 | 1.092868e+05 | 1.092888e+05 |
| 2023 | 1.265276e+05 | 1.265276e+05 | 1.239538e+05 | 1.239566e+05 |
| 2024 | 1.431621e+05 | 1.431621e+05 | 1.399327e+05 | 1.399371e+05 |
| 2025 | 1.612770e+05 | 1.612770e+05 | 1.572810e+05 | 1.572849e+05 |
| 2026 | 1.810041e+05 | 1.810041e+05 | 1.761030e+05 | 1.761110e+05 |
| 2027 | 2.024869e+05 | 2.024869e+05 | 1.965275e+05 | 1.965305e+05 |
| 2028 | 2.258817e+05 | 2.258817e+05 | 2.186523e+05 | 2.186624e+05 |
| 2029 | 2.513587e+05 | 2.513587e+05 | 2.426040e+05 | 2.426285e+05 |
| 2030 | 2.791031e+05 | 2.791031e+05 | 2.684088e+05 | 2.685572e+05 |
| 2031 | 3.093167e+05 | 3.093167e+05 | 2.964924e+05 | 2.965880e+05 |
| 2032 | 3.422194e+05 | 3.422194e+05 | 3.265795e+05 | 3.268766e+05 |
| 2033 | 3.780504e+05 | 3.780504e+05 | 3.594092e+05 | 3.595981e+05 |
| 2034 | 4.170703e+05 | 4.170703e+05 | 3.944386e+05 | 3.949450e+05 |
| 2035 | 4.595630e+05 | 4.595630e+05 | 4.321484e+05 | 4.331229e+05 |
| 2036 | 5.058376e+05 | 5.058376e+05 | 4.738051e+05 | 4.743466e+05 |
| 2037 | 5.562306e+05 | 5.562306e+05 | 5.168462e+05 | 5.188456e+05 |
| 2038 | 6.111086e+05 | 6.111086e+05 | 5.655083e+05 | 5.668911e+05 |
| 2039 | 6.708708e+05 | 6.708708e+05 | 6.179569e+05 | 6.188420e+05 |
| 2040 | 7.359517e+05 | 7.359517e+05 | 6.738941e+05 | 6.751908e+05 |
| 2041 | 8.068249e+05 | 8.068249e+05 | 7.358673e+05 | 7.365804e+05 |
| 2042 | 8.840058e+05 | 8.840058e+05 | 8.034410e+05 | 8.037732e+05 |
| 2043 | 9.680558e+05 | 9.680558e+05 | 8.770290e+05 | 8.775781e+05 |
| 2044 | 1.059586e+06 | 1.059586e+06 | 9.577546e+05 | 9.587624e+05 |
| 2045 | 1.159263e+06 | 1.159263e+06 | 1.047591e+06 | 1.047979e+06 |
| 2046 | 1.267811e+06 | 1.267811e+06 | 1.145374e+06 | 1.145737e+06 |
| 2047 | 1.386019e+06 | 1.386019e+06 | 1.252346e+06 | 1.252450e+06 |
| 2048 | 1.514749e+06 | 1.514749e+06 | 1.368511e+06 | 1.368533e+06 |
| 2049 | 1.654935e+06 | 1.654935e+06 | 1.494535e+06 | 1.494556e+06 |
| 2050 | 1.807597e+06 | 1.807597e+06 | 1.631358e+06 | 1.631361e+06 |
data
| newInstalledCapacity_standard_[MW] | newInstalledCapacity_decadence_[MW] | |
|---|---|---|
| year | ||
| 1995 | 1.250000e+01 | 1.250000e+01 |
| 1996 | 2.216767e+01 | 2.216767e+01 |
| 1997 | 3.378967e+01 | 3.378967e+01 |
| 1998 | 4.557067e+01 | 4.557067e+01 |
| 1999 | 6.245533e+01 | 6.245533e+01 |
| 2000 | 8.338200e+01 | 8.338200e+01 |
| 2001 | 1.113670e+02 | 1.113670e+02 |
| 2002 | 1.538430e+02 | 1.538430e+02 |
| 2003 | 2.135880e+02 | 2.135880e+02 |
| 2004 | 3.083400e+02 | 3.083400e+02 |
| 2005 | 4.049212e+02 | 4.049212e+02 |
| 2006 | 5.031342e+02 | 5.031342e+02 |
| 2007 | 8.273670e+02 | 8.273670e+02 |
| 2008 | 1.141952e+03 | 1.141952e+03 |
| 2009 | 1.573197e+03 | 1.573197e+03 |
| 2010 | 2.293041e+03 | 2.293041e+03 |
| 2011 | 4.074418e+03 | 4.074418e+03 |
| 2012 | 7.138581e+03 | 7.138581e+03 |
| 2013 | 1.117603e+04 | 1.117603e+04 |
| 2014 | 1.489823e+04 | 1.489823e+04 |
| 2015 | 2.173256e+04 | 2.173256e+04 |
| 2016 | 3.463022e+04 | 3.463022e+04 |
| 2017 | 4.441473e+04 | 4.441473e+04 |
| 2018 | 5.376726e+04 | 5.376726e+04 |
| 2019 | 6.471704e+04 | 6.471704e+04 |
| 2020 | 7.962083e+04 | 7.962083e+04 |
| 2021 | 9.607639e+04 | 9.607639e+04 |
| 2022 | 1.113036e+05 | 1.113036e+05 |
| 2023 | 1.265276e+05 | 1.265276e+05 |
| 2024 | 1.431621e+05 | 1.431621e+05 |
| 2025 | 1.612770e+05 | 1.612770e+05 |
| 2026 | 1.810041e+05 | 1.810041e+05 |
| 2027 | 2.024869e+05 | 2.024869e+05 |
| 2028 | 2.258817e+05 | 2.258817e+05 |
| 2029 | 2.513587e+05 | 2.513587e+05 |
| 2030 | 2.791031e+05 | 2.791031e+05 |
| 2031 | 3.093167e+05 | 3.093167e+05 |
| 2032 | 3.422194e+05 | 3.422194e+05 |
| 2033 | 3.780504e+05 | 3.780504e+05 |
| 2034 | 4.170703e+05 | 4.170703e+05 |
| 2035 | 4.595630e+05 | 4.595630e+05 |
| 2036 | 5.058376e+05 | 5.058376e+05 |
| 2037 | 5.562306e+05 | 5.562306e+05 |
| 2038 | 6.111086e+05 | 6.111086e+05 |
| 2039 | 6.708708e+05 | 6.708708e+05 |
| 2040 | 7.359517e+05 | 7.359517e+05 |
| 2041 | 8.068249e+05 | 8.068249e+05 |
| 2042 | 8.840058e+05 | 8.840058e+05 |
| 2043 | 9.680558e+05 | 9.680558e+05 |
| 2044 | 1.059586e+06 | 1.059586e+06 |
| 2045 | 1.159263e+06 | 1.159263e+06 |
| 2046 | 1.267811e+06 | 1.267811e+06 |
| 2047 | 1.386019e+06 | 1.386019e+06 |
| 2048 | 1.514749e+06 | 1.514749e+06 |
| 2049 | 1.654935e+06 | 1.654935e+06 |
| 2050 | 1.807597e+06 | 1.807597e+06 |
mylegend = [col.split('_')[1:] for col in data]
mylegend = [col[:-1] for col in mylegend]
mylegend
[['standard'], ['decadence']]
test_list=['standard', 'decadence', '2standard', '2decadence']
test_list2=['asdfadsf', 'dfdffd', 'dfsfs', 'ssssssss']
#str(test_list)[1:-1]
test_list + test_list2
['standard', 'decadence', '2standard', '2decadence', 'asdfadsf', 'dfdffd', 'dfsfs', 'ssssssss']
test_list
['standard', 'decadence', '2standard', '2decadence']